package indi.luckly.common.key;

public enum ErrorKey {
    SUCCEED(0),
    DIFFERENT_PASSWORDS(10000),
    ACCOUNT_CREATE_FAILURE(10001),
    ACCOUNT_ALREADY_LOGIN(10002),
    USER_NAME_OR_PASSWORD_NOT_EXISTS(10003),
    NO_PASSWORD_SET(10004),
    SIGNED_IN(10005),
    USER_NON_EXISTENT(10006),
    PARAMS_DELETION(10007),
    UPDATE_USER_INFO_ERROR(10008),
    USER_INFO_NON_EXISTENT(10009),

    UNKNOWN(9999);

    private int value;

    ErrorKey(int i) {
        value = i;
    }

    public int getValue() {
        return value;
    }

    /**
     * 获取错误码描述
     *
     * @return 返回描述信息
     */
    public String describe() {
        String describe = null;

        switch (this) {

            case SUCCEED:
                describe = "成功";
                break;
            case DIFFERENT_PASSWORDS:
                describe = "两次输入密码不同";
                break;
            case ACCOUNT_CREATE_FAILURE:
                describe = "用户创建失败";
                break;
            case ACCOUNT_ALREADY_LOGIN:
                describe = "用户已登录";
                break;
            case USER_NAME_OR_PASSWORD_NOT_EXISTS:
                describe = "用户名或密码错误";
                break;
            case NO_PASSWORD_SET:
                describe = "没有设置密码";
                break;
            case SIGNED_IN:
                describe = "已签到";
                break;
            case USER_NON_EXISTENT:
                describe = "用户不存在";
                break;
            case PARAMS_DELETION:
                describe = "参数缺失";
                break;
            case UPDATE_USER_INFO_ERROR:
                describe = "用户信息更新失败";
                break;
            case USER_INFO_NON_EXISTENT:
                describe = "用户信息不存在";
                break;

            case UNKNOWN:
            default:
                describe = "未知错误";
                break;
        }
        return describe;
    }
}
